##xxxxxxxxxxxxxxxxxxxxxx Paths configs
## message(STATUS "[my] CMake binary dir: ${CMAKE_BINARY_DIR}")
set(MY_ROOT_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Root directory of this project")
message(STATUS "[my] Root directory of this project: ${MY_ROOT_DIR}")
## MY_UPPER_ROOT 是 ROOT dir 往上一层的目录; 通常是 git 仓库根目录
# get_filename_component(MY_UPPER_ROOT ${MY_ROOT_DIR} DIRECTORY CACHE "Totally git repo dir")
set(MY_UPPER_ROOT ${MY_ROOT_DIR} CACHE PATH "Upper root of this project")
message(STATUS "[my] Upper root of this project: ${MY_UPPER_ROOT}")
##xxxxxxxxxxxxxxxxxxxxxx
set(MY_COMMON_DIR "${MY_UPPER_ROOT}/src/common" CACHE PATH "common include directory")
set(MY_THIRD_PARTY_HXX "${MY_UPPER_ROOT}/thirdpartyhxx" CACHE PATH "third party head-only libs") # header only 三方库
set(MY_CONAN_RUNTIME_DIR "${CMAKE_BINARY_DIR}/runtime/" CACHE PATH "Conan runtime collection directory")
message(STATUS "[my] Conan runtime collection directory: ${MY_CONAN_RUNTIME_DIR}")
set(MY_TESTIO_DIR "${MY_UPPER_ROOT}/test_io" CACHE PATH "test io files") # 测试输入输出文件夹
##xxxxxxxxxxxxxxxxxxxxxx 二进制输出目录
# set(MY_PATH_BIN ${CMAKE_BINARY_DIR} CACHE PATH "Binary output directory") # build 结果 output directory
set(MY_PATH_BIN "${MY_ROOT_DIR}/bin" CACHE PATH "Binary output directory")
message(STATUS "[my] Binary output directory: ${MY_PATH_BIN}")
# 检查是否为单配置生成器（如 Ninja）或多配置生成器（如 Visual Studio）
if(CMAKE_CONFIGURATION_TYPES)
    # 多配置生成器（如 Visual Studio）
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MY_PATH_BIN})
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MY_PATH_BIN})
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${MY_PATH_BIN})
    message(STATUS "[my] Multi-config generator - Output directory: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
else()
    # 单配置生成器（如 Ninja）
    # if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Release")
    set(OUTPUT_SUBDIR ${CMAKE_BUILD_TYPE})
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${MY_PATH_BIN}/${OUTPUT_SUBDIR}")
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${MY_PATH_BIN}/${OUTPUT_SUBDIR}")
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${MY_PATH_BIN}/${OUTPUT_SUBDIR}")
    message(STATUS "[my] Single-config generator - Output directory: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
    # endif()
endif()

##xxxxxxxxxxxxxxxxxxxxxx 自行编译的第三方库
set(MY_THIRD_PARTY "${MY_ROOT_DIR}/thirdparty" CACHE PATH "Third party directory")

##xxxxxxxxxxxxxxxxxxxxxx 日志的输出目录
set(MY_LOG_DIR "${MY_PATH_BIN}/logs" CACHE PATH "Logs directory")

##xxxxxxxxxxxxxxxxxxxxxx dllexport header files dir
set(MY_EXPORTS_DIR "${MY_ROOT_DIR}/export_headers" CACHE PATH "Export headers directory")

##xxxxxxxxxxxxxxxxxxxxxx cmake install dir
set(CMAKE_INSTALL_PREFIX "${MY_ROOT_DIR}/inst-demo" CACHE PATH "Install path" FORCE) # 安装目录, demo
message(STATUS "[my] Binary install demo directory: ${CMAKE_INSTALL_PREFIX}")